<template>
	<view class="pingluncontainer" v-show="show">
		<view class="flexcenter1" v-if="!list.data.length">
			<view class="placeholderimg" style="margin-top: 300rpx;">
				<image src="../../static/images/bg-icons/placeholderimg.png" mode=""></image>
			</view>
			<view class="zanwushuju">暂无数据~</view>
		</view>
		<view class="pinglunitem mtop flextop" v-for="item in list.data" :key="item.id">
			<view class="left">
				<image class="touxiang" :src="item.user.avatar"></image>
			</view>
			<view class="right">
				<view class="flexbetween">
					<view class="nicheng">{{item.user.nickname}}</view>
					<view class="time">{{item.createtime_text}}</view>
				</view>
				<view class="stars">
					<u-rate active-color="#00D2E1" :value="item.star" readonly inactive-color="#b2b2b2" gutter="2"></u-rate>
				</view>
				<view class="pingcontent">{{item.content}}</view>
				<view class="flexleft flex_wrap" v-if="item.images.length">
					<view class="itembox flexcenter"  v-for="ite in item.images_text" :key="ite">
						<image :src="ite" class=" border-r2 image"></image>
					</view>
				</view>
			</view>
		</view>
	  
	 	
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
				listid:"",
				
				show:false,
			};
		},
		onLoad(options) {
			this.listid = options.id
			this.init()
		},
		methods:{
			// 热门推荐列表
			init(isPage, page) {
				let _this = this;
				httpRequest.request('api/shop/commentList', 'GET', {
					id:this.listid,
					page: page || 1,
					limit: _this.limit,
				}, false, false, false).then(res => {
					this.show=true
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					this.show=true
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style lang="scss" scoped>
.pingluncontainer{
	// padding-top: 30rpx;
	background-color: #fafafa;
	min-height: 100vh;;
}
.pinglunitem{
	background-color: #FFFFFF;
	padding: 30rpx;
}
.left{
	.touxiang{
		width: 73rpx;
		height: 73rpx;
		border-radius: 50%;
	}
}
.right{
	flex: 1;
	display: flex;
	flex-direction: column;
	margin-left: 20rpx;
}
.nicheng{
	font-size: 32rpx;
	font-family: PingFang SC-Medium, PingFang SC;
	font-weight: 500;
	color: #000000;
	line-height: 38rpx;
}
.time{
	font-size: 26rpx;
	font-family: PingFang SC-Medium, PingFang SC;
	font-weight: 500;
	color: #666666;
	line-height: 30rpx;
}
.pingcontent{
	margin-top: 10rpx;
	font-size: 26rpx;
	font-family: PingFang SC-Medium, PingFang SC;
	font-weight: 500;
	color: #666666;
	line-height: 30rpx;
}
.itembox{
	width: 25%;
	margin-top: 20rpx;
	.image{
		width: 130rpx;
		height: 130rpx;
	}
}

.mtop{
	margin-top: 30rpx;
}
</style>
